﻿#region Using References

using System;
using System.Collections.Generic;
using Beaker.Services.FileSystem;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FileSystemService = Beaker.Services.FileSystem.Physical.FileSystemService;

#endregion

namespace Beaker.Services.Specs
{
	[TestClass]
	public class Integration_FileSystemServiceSpecs
	{

		[TestMethod]
		public void Integration_GetFoldersOnRootGivesDrives()
		{
			// arrange
			var fs = new FileSystemService();

			// act
			IEnumerable<IFolder> folders = fs.GetFolders();

			// assert
			folders.Should().Contain( f => f.Name.Equals( @"C:\", StringComparison.InvariantCultureIgnoreCase ) );
		}

		[TestMethod]
		public void Integration_GetFoldersOnDrivesGiveFolders()
		{
			// arrange
			var fs = new FileSystemService();
			IFolder rootFolder = fs.GetFolder( @"C:\" );

			// act
			IEnumerable<IFolder> folders = rootFolder.GetFolders();

			// assert
			folders.Should().Contain( f => f.Name.Equals( "Program Files", StringComparison.InvariantCultureIgnoreCase ) );
		}

		[TestMethod]
		public void Integration_ParseReturnsAFolderTree()
		{
			// arrange
			var fs = new FileSystemService();

			// act
			IFileSystemEntry folder = fs.ParsePath( @"C:\Program Files" );

			// assert
			folder.Should().BeAssignableTo<IFolder>();
			folder.Name.Should().Be( "Program Files" );
			folder.ParentFolder.Name.Should().Be( @"C:\" );
		}
	}
}
